﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;

using SampleTryouts.Infrastructure;
using Cobisi.Web.MvcExtensions; // using MVC extensions for the routing

namespace SampleTryouts
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            // Setup the runtime license key for Cobisi SEO Extensions
            DeclarativeRouteRegistration.RuntimeLicenseKey = "f+IV6N2KNUf0SS/uSmPcuSnRlnwHYv3t72l+Rk+simfz3ZkOaWpOyhOxlT7m37UChGZYKg==";

            
            AreaRegistration.RegisterAllAreas();

            // Ninject; IoC / DI
            DependencyResolver.SetResolver(new NinjectDependencyResolver());

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }

        // Cobisi MVC Extensions...
        public static void RegisterRoutes(RouteCollection routes)
        {
            // SEO routing model registration

            DeclarativeRouteRegistration.RegisterRoutes();

            // Standard ASP.NET routes

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "mega", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new
                {
                    controller = "HomeController",
                    action = "Index",
                    id = UrlParameter.Optional
                }
            );
        }
    }


}